POV-Ray : Newsgroups : povray.general : I need math help : Re: I need math help Server Time
19 Nov 2024 11:35:58 EST (-0500)
  Re: I need math help  
From: Randy Hawley
Date: 6 Mar 2002 00:52:47
Message: <3C85AF4F.76F919D7@iquest.net>
Bob,

I think what you are asking for is to have a value decay to some arbitrary
limit.  You will then need to evaluate the current value at some regular
interval, but you don't know ahead of time what the interval will be.

I guess what I see this working out to be is a curve that at the intial point of
the problem has some derivative that is not zero.  At the final point, its
derivative is zero.

What kind of a curve you use to figure this out is dependent on what kind of
motion you want the object to have.

A "simple" deceleration will generate a straight line, the velocity dropping
steadily as you appoach the end point.

More gradual deceleration, more like a car braking with most of the slowing done
in the late part of the path, would be more like a parabola.

This kind of motion is well described in the  Clock Mod Tutorial .  You should
check it out.

Randy

=Bob= wrote:

> Hi Tor,
>
> Thanks again for helping me. I think either I didn't
> explain my needs correctly, or I don't understand
> how to implement your suggestions for my case.
>
> Here's my scenario:
>
> I have 62 meters over which I must move an object.
> It is currently moving at 1 meter per sec.
> I want to come to a complete stop when I get to 62 meters.
> I want to gradually slow down for the duration of those 62 meters.
> I have no idea how many steps it will take.
>
> The magic number for this example is about 0.008009
>
> As I subtract the magic number from the current
> increment value (starting at 1), when I reach the 62
> meter mark, the increment value is very close to 0.
>
> Code snippet kluge:
> ================================
> #declare len = 62;
> #declare inc = 1;
> #declare currpos = 0;
> #declare incChg = 0.008009;  // how do I calculate this number?
> #declare nStepCt = 0;
>
> #while (currpos <= len & inc >= incChg)
>    #debug concat("CurrPos: ",str(currpos,0,-1),"  Inc: ",str(inc,0,-1),"\n")
>    #declare inc = inc - incChg;
>    #declare currpos = currpos + inc;
>    #declare nStepCt = nStepCt + 1;
> #end // while
>
> #debug concat("Steps: ",str(nStepCt,0,-1)," incChg: ",str(incChg,0,-1),"\n")
> ==================================
> This takes 124 steps to complete.
>
> How do I calculate the value of "incChg" ?
> Maybe there's a better way to do this?
> Thanks again for your kind help...
> =Bob=


Post a reply to this message


Attachments:
Download 'us-ascii' (3 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.